package hello.app.util;

import hello.app.Application;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;

public class YesNoDialogBuilder extends Builder {

	YesNoListener mYesNo;
	public interface YesNoListener{
		public void onYes();
		public void onNo();
	}


	public YesNoDialogBuilder(Context context, String meg, YesNoListener yesNoListener) {
		super(context);
		this.mYesNo = yesNoListener;
		setTitle(Application.TITLE);
		setMessage(meg);
		setPositiveButton("OK",
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
						mYesNo.onYes();
						dialog.cancel();
					}
			}
		);

		setNegativeButton("キャンセル",
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
						mYesNo.onNo();
						dialog.cancel();
					}
			}
		);
	}

}
